package com.link2room.soundwave.controller.inside;


import com.link2room.common.dto.result.base.BaseResultDto;
import com.link2room.soundwave.dto.param.inside.PmsRoomAvailInsideParamDto;
import com.link2room.soundwave.util.HandlerUtil;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by VegetaKo on 2016/9/12.
 */
@Api(tags = "PMS房量相关")
@RestController
@RequestMapping("/in/PMSStocks")
public class PMSStockInsideController {

    @RequestMapping(method = RequestMethod.GET)
    public BaseResultDto RoomAvail(
            @RequestParam(value = "lhotelCode", required = true) String lhotelCode,
            @RequestParam(value = "arrtime", required = false) String arrtime,
            @RequestParam(value = "deptime", required = false) String deptime,
            @RequestParam(value = "rmtypes", required = false) String rmtypes,
            @RequestParam(value = "l2RRmtypes", required = false) String l2RRmtypes
    ) throws Exception {
        PmsRoomAvailInsideParamDto roomAvailInsideParamDto = new PmsRoomAvailInsideParamDto();
        roomAvailInsideParamDto.setLhotelCode(lhotelCode);
        roomAvailInsideParamDto.setArrtime(arrtime);
        roomAvailInsideParamDto.setDeptime(deptime);
        roomAvailInsideParamDto.setRmtypes(rmtypes);
        roomAvailInsideParamDto.setL2RRmtypes(l2RRmtypes);
        BaseResultDto l2rRs = new BaseResultDto();
        l2rRs.setResultCode(0);
        l2rRs.setQueryResult(HandlerUtil.pmsRoomAvailHandler().getPmsRoomAvailHandler(roomAvailInsideParamDto));
        return l2rRs;
    }

    @RequestMapping(value = "/Direct", method = RequestMethod.GET)
    public BaseResultDto RoomAvailDirect(
            @RequestParam(value = "lhotelCode", required = true) String lhotelCode,
            @RequestParam(value = "arrtime", required = false) String arrtime,
            @RequestParam(value = "deptime", required = false) String deptime,
            @RequestParam(value = "pmsRatecode", required = false) String pmsRatecode,
            @RequestParam(value = "salesChannel", required = false) String salesChannel,
            @RequestParam(value = "l2RRmtypes", required = false) String l2RRmtypes
    ) throws Exception {
        PmsRoomAvailInsideParamDto roomAvailInsideParamDto = new PmsRoomAvailInsideParamDto();
        roomAvailInsideParamDto.setLhotelCode(lhotelCode);
        roomAvailInsideParamDto.setArrtime(arrtime);
        roomAvailInsideParamDto.setDeptime(deptime);
        roomAvailInsideParamDto.setL2RRmtypes(l2RRmtypes);
        roomAvailInsideParamDto.setPmsRatecode(pmsRatecode);
        roomAvailInsideParamDto.setSalesChannel(salesChannel);
        BaseResultDto l2rRs = new BaseResultDto();
        l2rRs.setResultCode(0);
        l2rRs.setQueryResult(HandlerUtil.pmsRoomAvailHandler().getPmsRoomAvailDirectHandler(roomAvailInsideParamDto));
        return l2rRs;
    }

}
